package com.xxx.video.network.requests;

import java.util.HashMap;

public final class RequestParams {
    /**
     * request Url
     */
    private String url;
    /**
     * request Params
     */
    private HashMap<String, Object> params = new HashMap<>();
    /**
     * request jsonObject
     */
    private Object jsonObjectParams;
    /**
     * is use map params
     */
    private boolean isUsedMapParams = true;
    /**
     * this is a file map params
     */
    private HashMap<String, Object> fileParams = new HashMap<>();
    /**
     * request headers
     */
    private HashMap<String, String> headers = new HashMap<>();

    /**
     * get request url
     *
     * @return request url
     */
    public String getUrl() {
        return url;
    }

    /**
     * set request url
     *
     * @param url request url
     */
    public RequestParams setUrl(String url) {
        this.url = url;
        return this;
    }

    /**
     * get request map params
     *
     * @return request map params
     */
    public HashMap<String, Object> getParams() {
        return params;
    }

    /**
     * add request map params
     *
     * @param paramsKey   request map params key
     * @param paramsValue request map params value
     */
    public RequestParams addParams(String paramsKey, Object paramsValue) {
        this.params.put(paramsKey, paramsValue);
        return this;
    }

    /**
     * get all request header
     *
     * @return request header map
     */
    public HashMap<String, String> getHeaders() {
        return headers;
    }

    /**
     * add request header
     *
     * @param headerKey   request header key
     * @param headerValue request header value
     */
    public RequestParams addHeaders(String headerKey, String headerValue) {
        this.headers.put(headerKey, headerValue);
        return this;
    }

    /**
     * get file params map
     *
     * @return file params map
     */
    public HashMap<String, Object> getFileParams() {
        return fileParams;
    }

    /**
     * add  file params map
     *
     * @param filePath  file path
     * @param fileValue file
     */
    public RequestParams addFileParams(String filePath, Object fileValue) {
        this.fileParams.put(filePath, fileValue);
        return this;
    }

    /**
     * get request jsonObject
     *
     * @return jsonObject
     */
    public Object getJsonObjectParams() {
        return jsonObjectParams;
    }

    /**
     * set request jsonObject
     *
     * @param jsonObjectParams jsonObject
     */
    public RequestParams setJsonObjectParams(Object jsonObjectParams) {
        this.jsonObjectParams = jsonObjectParams;
        return this;
    }

    /**
     *  get is use map params (default true)
     *
     * @return is use
     */
    public boolean isUsedMapParams() {
        return isUsedMapParams;
    }

    /**
     * set is use map params (default true)
     *
     * @param usedMapParams is use
     */
    public RequestParams setUsedMapParams(boolean usedMapParams) {
        isUsedMapParams = usedMapParams;
        return this;
    }


}
